﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Admin_Article.aspx.cs"
    Inherits="V5_EShop.Admin.Admin_Article" MasterPageFile="~/Admin/admin.Master" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Header" runat="server">
    <script type="text/javascript">
        function checkform() {
            var title = $("#txtTitle").val();
            var classid = $("#ddlClassID").val();
            var content = $("#txtContent").val();
            if (title == "") {
                alert("标题不能为空!");
                return false;
            }
            if (classid == 0) {
                alert("请选择一个分类!");
                return false;
            }
            return true;
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Title" runat="server">
    文章中心
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Nav" runat="server">
    <a href="Admin_Article.aspx">管理文章</a> | <a href="Admin_Article.aspx?Action=edit">添加文章</a>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Content" runat="server">
    <asp:MultiView ID="MultiViewList" runat="server">
        <asp:View ID="View1" runat="server">
            <asp:GridView ID="gvList" runat="server" AutoGenerateColumns="False"
                CssClass="tablelist tableheader overlist" GridLines="None" OnRowCommand="gvList_RowCommand">
                <Columns>
                    <asp:TemplateField HeaderText="选择">
                        <ItemTemplate>
                            <asp:CheckBox ID="chkitem" runat="server" />
                        </ItemTemplate>
                        <ItemStyle Width="30px" />
                    </asp:TemplateField>
                    <asp:BoundField DataField="ID" HeaderText="ID">
                        <ItemStyle Width="30px" />
                    </asp:BoundField>
                    <asp:BoundField DataField="Title" HeaderText="标题" />
                    <asp:BoundField DataField="Editor" HeaderText="录入者/编辑者">
                        <ItemStyle Width="150px" />
                    </asp:BoundField>
                    <asp:BoundField DataField="Hits" HeaderText="点击">
                        <ItemStyle Width="40px" />
                    </asp:BoundField>
                    <asp:TemplateField HeaderText="审核">
                        <ItemTemplate>
                            <%# DataBinder.Eval(Container, "DataItem.Passed").ToString()=="1"?"√":"×"%>
                        </ItemTemplate>
                        <ItemStyle Width="40px" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="操作">
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" CommandArgument='<%#Eval("ID")%>'
                                CommandName="go">修改</asp:LinkButton>
                            <asp:LinkButton ID="LinkButton2" runat="server" CommandArgument='<%#Eval("ID")%>'
                                CommandName="del">删除</asp:LinkButton>
                        </ItemTemplate>
                        <ItemStyle Width="150px" />
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
            <table width="96%" border="0" align="center" cellpadding="0" cellspacing="0" class="tablelist">
                <tr>
                    <td class="tdblank">搜索：
                        <asp:TextBox ID="txtSearchText" runat="server"></asp:TextBox>
                        <asp:Button ID="btnSearch" runat="server" CausesValidation="False" Text="搜 索" OnClick="btnSearch_Click" />
                    </td>
                </tr>
                <tr>
                    <td align="right" class="tdblank">
                        <input name="chkall" type="checkbox" id="chkall" onclick="javascript: SelectAll(this);"
                            value="checkbox" />
                        全选/取消
                        <asp:DropDownList ID="ddlAll" runat="server">
                            <asp:ListItem Value="0">请选择一个操作</asp:ListItem>
                            <asp:ListItem Value="1">批量删除</asp:ListItem>
                        </asp:DropDownList>
                        <asp:Button ID="btnAll" runat="server" Text="执行操作" EnableViewState="False" OnClick="btnAll_Click" />
                    </td>
                </tr>
                <tr>
                    <td align="right" class="tdblank">
                        <webdiyer:AspNetPager ID="Pager" runat="server" CustomInfoHTML="共%PageCount%页，当前为第%CurrentPageIndex%页，每页%PageSize%条"
                            FirstPageText="首页" HorizontalAlign="Right" LastPageText="尾页" NextPageText="下一页"
                            OnPageChanged="Pager_PageChanged" PageIndexBoxType="DropDownList" PageSize="20"
                            PrevPageText="上一页" ShowCustomInfoSection="Left" ShowPageIndexBox="Always" SubmitButtonText="Go"
                            TextAfterPageIndexBox="页" TextBeforePageIndexBox="转到" AlwaysShow="True">
                        </webdiyer:AspNetPager>
                    </td>
                </tr>
            </table>
        </asp:View>
        <asp:View ID="View2" runat="server">
            <table align="center" border="0" cellpadding="5" cellspacing="1" class="tablelist tableheader"
                width="96%">
                <tr>
                    <td colspan="4" class="headertext">&nbsp;
                        <asp:Label ID="lblTitle" runat="server" Text="添加文章"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td width="15%" align="right" style="height: 14px">标题：
                    </td>
                    <td colspan="3" style="height: 14px">
                        <asp:TextBox ID="txtTitle" runat="server" Width="363px"></asp:TextBox>
                        &nbsp;
                        <asp:CheckBox ID="chkPassed" runat="server" Text="立即发布" Checked="True" />
                    </td>
                </tr>
                <tr>
                    <td align="right" style="height: 22px">关键字：
                    </td>
                    <td colspan="3" style="height: 22px">
                        <asp:TextBox ID="txtKeys" runat="server" Width="361px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align="right" style="height: 14px">选择栏目：
                    </td>
                    <td colspan="3" style="height: 14px">
                        <asp:DropDownList ID="ddlClassID" runat="server">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td align="right">来源：
                    </td>
                    <td width="36%">
                        <asp:TextBox ID="txtCopyFrom" runat="server" Width="124px"></asp:TextBox>
                    </td>
                    <td width="11%" align="right">作者：
                    </td>
                    <td width="33%">
                        <asp:TextBox ID="txtAuthor" runat="server" Width="124px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align="right">转向链接：
                    </td>
                    <td colspan="3">
                        <asp:TextBox ID="txtLinkUrl" runat="server" Width="344px"></asp:TextBox>
                        <asp:CheckBox ID="chkLinkUrl" runat="server" Text="是" />
                    </td>
                </tr>
                <tr>
                    <td align="right">类型：
                    </td>
                    <td colspan="3">
                        <asp:CheckBox ID="chkIsOnTop" runat="server" Text="热门" />
                        <asp:CheckBox ID="chkRecommended" runat="server" Text="推荐" />
                    </td>
                </tr>
                <tr>
                    <td align="right">简介：
                    </td>
                    <td colspan="3">
                        <asp:TextBox ID="txtShortContent" runat="server" Height="101px" TextMode="MultiLine"
                            Width="546px"></asp:TextBox>不要超过200个字符
                    </td>
                </tr>
                <tr>
                    <td align="right" valign="top">详细内容：<br />
                        <input id="Button4" type="button" value="插入图片" onclick="OpenUpload('txtContent', 400, 150);" /></td>
                    <td colspan="3" valign="top">
                        <asp:TextBox ID="txtContent" runat="server" TextMode="MultiLine" Height="400px"></asp:TextBox>
                       <script>
                                var editor = new wangEditor('<%=this.txtContent.ClientID%>');
                                // 普通的自定义菜单
                                editor.config.menus = [
                                    'bold',
                                    'underline',
                                    'italic',
                                    'strikethrough',
                                    'eraser',
                                    'forecolor',
                                    'bgcolor',
                                    '|',
                                    'quote',
                                    'fontfamily',
                                    'fontsize',
                                    'head',
                                    'unorderlist',
                                    'orderlist',
                                    'alignleft',
                                    'aligncenter',
                                    'alignright',
                                    '|',
                                    'link',
                                    'unlink',
                                    'table',
                                    'emotion',
                                    'insertcode',
                                    '|',
                                    'undo',
                                    'redo',
                                    'fullscreen'
                                ];
                                editor.config.codeDefaultLang = 'C#'
                                editor.create();
                            </script>
                    </td>
                </tr>
                <tr>
                    <td align="right">图片：
                    </td>
                    <td colspan="3">
                        <asp:TextBox ID="txtDefaultPicUrl" runat="server" Width="333px"></asp:TextBox>
                        <input id="Button1" onclick="OpenPictureDialog('txtDefaultPicUrl', 620, 450);"
                            type="button" value="上传文件" />
                    </td>
                </tr>
                <tr>
                    <td align="right">点击次数：
                    </td>
                    <td colspan="3">
                        <asp:TextBox ID="txtHits" runat="server">0</asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align="center" colspan="4" style="height: 22px">
                        <asp:HiddenField ID="txtID" runat="server" Value="0" />
                        <asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click" Text="确认保存" OnClientClick="return checkform();" />
                        <input id="Reset1" type="reset" value="重新设置" />
                    </td>
                </tr>
            </table>
        </asp:View>
    </asp:MultiView>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Footer" runat="server">
</asp:Content>
